/**
  ******************************************************************************
  * @author     Chris
  * @since      2024/6/21 22:31
  *
  * @file       pd_i2c_hd.h
  * @brief      Header file of IIC hardware peripheral driver.
  *
  * @note       This file contains the IIC object declaration.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date          Author       Notes
  *   2024/6/21     Chris        the first version
  *
  ******************************************************************************
  */


#ifndef JLC_SKY_I2C_HD_H
#define JLC_SKY_I2C_HD_H

#include "pd_i2c.h"
#include "drivers.h"

typedef struct I2CHardwareDef I2CHardware;

struct I2CHardwareDef {
    IIC i2c;

    I2C_TypeDef *I2Cx;

    uint32_t PeripheralMode;
    uint32_t ClockSpeed;
    uint32_t DutyCycle;
#if  defined(I2C_FLTR_ANOFF) && defined(I2C_FLTR_DNF)
    uint32_t AnalogFilter;
    uint32_t DigitalFilter;
#endif
    uint32_t OwnAddress1;
    uint32_t TypeAcknowledge;
    uint32_t OwnAddrSize;
};

extern const struct I2CHardwareClass {
    I2CHardware *(*build)(I2C_TypeDef *I2Cx, GPIO *sck, GPIO *sda);
} I2CHardwareBuilder;

#endif //JLC_SKY_I2C_HD_H
